﻿<%@ Page Language="C#" %>

<%@ Import Namespace="wojilu" %>
<%@ Import Namespace="wojilu.View" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Domain" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Service" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>#{softtitle}</title>
<link href="#{path.css}ybb/css/baselist.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/all.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/formdiv.css?v=#{cssVersion}" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="#{path.js}ybb/js/jquery.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/control.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/form.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="/static/public/tinyMCE/jquery.tinymce.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/initedit.js?v=#{jsVersion}"></script>
<script type="text/javascript">

	var resizewindow= null;

	window.onresize = function(){
		var h = $(window).height();
		if(resizewindow!=h){
			sizewindow();
			resizewindow=h;
		}
	}

	function sizewindow(){
		var h = $(window).height();
		if(document.getElementById("mainbodybottonauto")){
			$('.managebottonadd').css({height:h-40});
		}
	}
	var formmessmain_js_content_mess = "_{formmessmain_js_content_mess}";
	var formmessmain_js_add_ok = "_{formmessmain_js_add_ok}";
	var formmessmain_js_add_ok = "_{formmessmain_js_add_ok}";
	var iframename = "#{iframename}";
	$(document).ready(function(){
	    var h = '#{iframeheightwindow}';
		$('.managebottonadd').css({height:h-40});
		editsimpleshow_height("#content");
		var options = {
			beforeSubmit: formverify,
			success:saveResponse,
			resetForm: true
		}
		$('#formmessedit').submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
	})




	function formverify(formData) {
		for (var i=0; i< formData.length; i++){
			if (formData[i].name == "content"){
				formData[i].value=tinyMCE.get('content').getContent();
			}
		}
		var queryString = $.param(formData);
		var get=urlarray(queryString);
		if(get['content']=='') {
			document.formmessedit.content.focus();
			alert(formmessmain_js_content_mess);
			return false;
		}
		parent.windowsdig('Loading', 'iframe:#{load}', '400px', '180px', 'iframe', false);
	}
	function saveResponse(options){
		parent.closeifram();
		if (options=='true'){
			parent.frames[iframename].refresh('selectform','selectall','check_all');
			alert(formmessmain_js_add_ok);
		}else{
			alert(formmessmain_js_add_no);
		}
		parent.onaletdoc()
	}
</script>
</head>

<body>
<%var read = v.data("read") as System.Data.IDataReader; %>
<%var form = v.data("form") as Form_Group; %>
<form name="formmessedit" id="formmessedit" method="post" action="#{ActionLink}">
<input type="hidden" name="inputclass" value="edit" />
<input type="hidden" name="isreply" value="<%=read["isreply"] %>" />
<input type="hidden" name="ismail" value="<%=form.ismail%>" />
<div id="mainbodybottonauto" class="managebottonadd">
	<div class="maindobycontent">
		<div class="suggestion">
			<span class="sugicon"><span class="strong colorgorning2">_{position_title}</span><span class="colorgorningage">_{formmessmain_type_add_mess}</span></span>
		</div>
		<div class="manageeditdiv">
			<div class="maneditcontent">
				<table class="formtable">
					<tr>
						<td  class="trtitle03" colspan="2">_{formmessmain_type_add_typelngmode}</td>
					</tr>
                    <%var attrlist = v.data("attrlist") as List<Form_Attr>; %>
					<%foreach (var row in attrlist){ %>
                    <%if(row.isline !=1){ %>
					<tr class="trstyle2">
						<td class="trtitle01"><%=row.typename %></td>
						<td class="trtitle02">
                            <%if (row.inputtype == "select" || row.inputtype == "radio" || row.inputtype == "heckbox") { %>
                            <%var strArray = row.attrvalue.SplitString("\r\n");
                            for (int i = 0; i < strArray.Length; i++) {%>
                            <%if(!read[row.attrname].IsNull() && strArray[i] == read[row.attrname]){ %>
							<%=strArray[i] %>
                            <%}%>
							<%} %>
                            <%}else if(row.inputtype == "datetime"){ %>
                            <%=read[row.attrname].ToString().ToDateTime() %>
							<%}else{ %>
                            <%=read[row.attrname] %>
							<%} %>
						</td>
					</tr>
					<%} %>
					<%} %>
					<tr>
						<td  class="trtitle03" colspan="2">_{formmessmain_type_add_isreply}</td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">_{formmessmain_text_formgroupname}</td>
						<td class="trtitle02"><%=form.formgroupname %></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">_{formmessmain_text_addtime}</td>
						<td class="trtitle02"><%=read["addtime"] %></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">_{forummain_add_ip}</td>
						<td class="trtitle02"><%=read["ipadd"] %></td>
					</tr>
                    <% var docread = v.data("docread") as Document; %>
					<%if(docread !=null){ %>
					<tr class="trstyle2">
						<td class="trtitle01">_{formmessmain_type_doc}</td>
						<td class="trtitle02"><a class="infolink02" target="_blank" href="<%=docread.readlink %>"><%=docread.title %></a></td>
					</tr>
					<%} %>
                     <%PowerGroup modelpowergroup = v.data("powergroup") as PowerGroup; %>
                    <%var bllPowerGroupService = new PowerGroupService(); %>
                    <%if(read["userid"].ObjectToInt() > 0){ %>
                    <%var user = wojilu.Members.Users.Domain.User.findById(read["userid"].ObjectToInt()); %>
					<tr class="trstyle2">
						<td class="trtitle01">_{formmessmain_type_member}</td>
						<td class="trtitle02"><%=user.Name %></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01"></td>
						<td class="trtitle02">ID=<%=user.Id %></td>
					</tr>
					<%} %>
                    <%if (read["isreply"].ObjectToInt() == 0) { %>
					<tr class="trstyle2">
						<td class="trtitle011">_{formmessmain_type_mail}</td>
						<td class="trtitle02">
							<input type="text" name="email" id="email" value="" size="40" maxlength="50" class="infoInput"/>
						</td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle011">_{formmessmain_type_add_isreply}</td>
						<td class="trtitle02"><textarea name="content" id="content" style="width:98%;height:200px;" class="smallInput"><%=read["recontent"] %></textarea></td>
					</tr>
					<%}else{ %>
                    <%if(form.ismail==0){ %>
					<tr class="trstyle2">
						<td class="trtitle01">_{formmessmain_type_retime}</td>
						<td class="trtitle02"><%=read["retime"] %></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">_{formmessmain_type_admin}</td>
						<td class="trtitle02"><%=read["username"] %></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">_{formmessmain_type_add_isreply}</td>
						<td class="trtitle02"><%=read["recontent"] %></td>
					</tr>
					<%}else{ %>
					<tr class="trstyle2">
						<td class="trtitle01">_{formmessmain_type_add_isreply}</td>
						<td class="trtitle02">_{formmessmain_js_ismail_err}</td>
					</tr>
					<%} %>
					<%} %>
				</table>
			</div>
		</div>
	</div>
</div>
<div id="downbotton">
	<div id="subbotton">
		<table border="0" width="100%">
			<tr>
				<td id="right"><input type="submit" id="messsubmitbotton" name="Submit" value="_{botton_remess}" class="buttonface" /></td>
				<td id="left" class="padding-left5"><input type="button" name="cancel" onClick="javascript:parent.onaletdoc();" value="_{botton_remess_reset}" class="buttonface" /></td>
			</tr>
		</table>
	</div>
</div>
</form>
</body>

</html>